package com.lucnn.diamond.spring.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

public class Car implements InitializingBean,DisposableBean,ApplicationContextAware {
    public Car(){
        System.out.println("car constructor");
    }

    public void init(){
        System.out.println("car init");
    }

    @PostConstruct
    public void postConstruct(){
        System.out.println("car postConstruct");
    }

    public void over(){
        System.out.println("car over");
    }

    public void destroy(){
        System.out.println("car destory");
    }

    public void afterPropertiesSet() throws Exception {
        System.out.println("car afterPropertiesSet");
    }

    @PreDestroy
    public void preDestory(){
        System.out.println("car preDestory");
    }

    private ApplicationContext applicationContext;

    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }
}
